/**
 * 初始化信用卡管理详情对话框
 */
var CreditCardOrderInfoDlg = {
    creditCardOrderInfoData : {}
};

/**
 * 清除数据
 */
CreditCardOrderInfoDlg.clearData = function() {
    this.creditCardOrderInfoData = {};
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
CreditCardOrderInfoDlg.set = function(key, val) {
    this.creditCardOrderInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
CreditCardOrderInfoDlg.get = function(key) {
    return $("#" + key).val();
}

/**
 * 关闭此对话框
 */
CreditCardOrderInfoDlg.close = function() {
    parent.layer.close(window.parent.CreditCardOrder.layerIndex);
}

/**
 * 收集数据
 */
CreditCardOrderInfoDlg.collectData = function() {
    this
    .set('id')
    .set('orderid')
    .set('applyCompleted')
    .set('applicationStatus')
    .set('mailed')
    .set('activated')
    .set('firstUsed')
    .set('barCode')
    .set('phone')
    .set('orderCode')
    .set('bankType')
    .set('currentStatus')
    .set('createTime')
    .set('updateTime')
    .set('userid')
    .set('parentUserid')
    .set('rootUserid')
    .set('regCode')
    .set('status')
    .set('addvar')
    .set('reward1')
    .set('reward2')
    .set('userName')
    .set('useridReward')
    .set('parentUseridReward')
    .set('rootUseridReward')
    .set('currency')
    .set('isNew');
}

/**
 * 提交添加
 */
CreditCardOrderInfoDlg.addSubmit = function() {

    this.clearData();
    this.collectData();

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/creditCardOrder/add", function(data){
        Feng.success("添加成功!");
        window.parent.CreditCardOrder.table.refresh();
        CreditCardOrderInfoDlg.close();
    },function(data){
        Feng.error("添加失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.creditCardOrderInfoData);
    ajax.start();
}

/**
 * 提交修改
 */
CreditCardOrderInfoDlg.editSubmit = function() {
    // alert("修改功能暂时关闭");
    Feng.alert("修改功能暂时关闭")
    return;
    this.clearData();
    this.collectData();
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/creditCardOrder/update", function(data){
        Feng.success("修改成功!");
        window.parent.CreditCardOrder.table.refresh();
        CreditCardOrderInfoDlg.close();
    },function(data){
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.creditCardOrderInfoData);
    ajax.start();
}

$(function() {

});
